package com.lkd.mapper;

import com.lkd.dto.SkuClassDto;
import com.lkd.dto.SkuClassPageDto;
import com.lkd.entity.SkuClass;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SkuClassMapper {
    //新增分类
    @Insert("insert into lkdremake.tb_sku_class (class_name, parent_id) values (#{className},#{parentId})")
    Boolean save(SkuClassDto skuClassDto);
    //分类分页查询
    List<SkuClass> getList(SkuClassPageDto skuClassPageDto);
    //修改分类
    Boolean updateById(SkuClassDto skuClassDto);

    //查询回显
    @Select("select * from lkdremake.tb_sku_class where class_id=#{classId}")
    SkuClassDto getById(Integer classId);

    //删除分类
    @Delete("delete from lkdremake.tb_sku_class where class_id=#{classId}")
    Boolean deleteById(Integer classId);

    @Select("select * from lkdremake.tb_sku_class where class_id=#{classId}")
    SkuClass getByClassId(Integer classId);
}
